﻿/*****************************************************************************
 * 
 * ReoGrid - .NET Spreadsheet Control
 * 
 * https://reogrid.net/
 *
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 * PURPOSE.
 *
 * Author: Jingwood <jingwood at unvell.com>
 *
 * Copyright (c) 2012-2023 Jingwood <jingwood at unvell.com>
 * Copyright (c) 2012-2023 unvell inc. All rights reserved.
 * 
 ****************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace unvell.ReoGrid.Views
{
	internal abstract class LayerViewport : Viewport
	{
		public LayerViewport(IViewportController vc)
			: base(vc)
		{
		}

		public override void UpdateView()
		{
			if (this.children != null)
			{
				foreach (var child in this.children)
				{
					child.Bounds = this.bounds;
					child.ScaleFactor = this.scaleFactor;

					if (child is IViewport childViewport)
					{
						childViewport.ViewStart = this.viewStart;
						childViewport.ScrollX = this.ScrollX;
						childViewport.ScrollY = this.ScrollY;
						childViewport.VisibleRegion = this.visibleRegion;
						childViewport.ScrollableDirections = this.ScrollableDirections;
					}

					child.UpdateView();
				}
			}
		}
	}
}
